package casamento.DAO;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import org.hibernate.Session;
import org.hibernate.Transaction;

import casamento.Bean.ClienteBean;
import casamento.Bean.LoginBean;

public class LoginDAO {

	Connection connection;
	Conexao con = new Conexao();

	// verificar usuário.
	public List<LoginBean> usuario() {
		
		List<LoginBean> lista = new ArrayList<LoginBean>();
		Session session = HibernateUtil.getSessionFactory().openSession();
		Transaction t = session.beginTransaction();
		lista = session.createQuery("FROM Tblogin").list();
		t.commit();

		return lista;
	}

	public void alterarUsuario(LoginBean login) {

		Session session = HibernateUtil.getSessionFactory().openSession();
		Transaction t = session.beginTransaction();
		session.update(login);
		t.commit();

	}

}
